package ae.pcfc.etks.online.common.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ServiceSecurityRole entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_SERVICE_SECURITY_ROLE", schema = "ETKS_ONLINE_DBA")
@SequenceGenerator(name = "SQ_ETKS_S_SEC_ROLE", sequenceName = "SQ_ETKS_S_SEC_ROLE", initialValue = 1, allocationSize = 1)
public class ServiceSecurityRole implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -1077576966594763090L;
	private Long ssRoleId;
	private Service Service;
	private String ssRoleInfo;
	private Set<UserServiceSecurity> UserServiceSecurities = new HashSet<UserServiceSecurity>(
			0);

	// Constructors

	/** default constructor */
	public ServiceSecurityRole() {
	}

	/** minimal constructor */
	public ServiceSecurityRole(String ssRoleInfo) {
		this.ssRoleInfo = ssRoleInfo;
	}

	/** full constructor */
	public ServiceSecurityRole(Service Service,
			String ssRoleInfo,
			Set<UserServiceSecurity> UserServiceSecurities) {
		this.Service = Service;
		this.ssRoleInfo = ssRoleInfo;
		this.UserServiceSecurities = UserServiceSecurities;
	}

	// Property accessors
	@Id
	@GeneratedValue( strategy = GenerationType.SEQUENCE, generator="SQ_ETKS_S_SEC_ROLE")
	@Column(name = "SS_ROLE_ID", nullable = false, precision = 11, scale = 0)
	public Long getSsRoleId() {
		return this.ssRoleId;
	}

	public void setSsRoleId(Long ssRoleId) {
		this.ssRoleId = ssRoleId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SERVICE_ID")
	public Service getService() {
		return this.Service;
	}

	public void setService(Service Service) {
		this.Service = Service;
	}

	@Column(name = "SS_ROLE_INFO", nullable = false, length = 25)
	public String getSsRoleInfo() {
		return this.ssRoleInfo;
	}

	public void setSsRoleInfo(String ssRoleInfo) {
		this.ssRoleInfo = ssRoleInfo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "serviceSecurityRole")
	public Set<UserServiceSecurity> getUserServiceSecurities() {
		return this.UserServiceSecurities;
	}

	public void setUserServiceSecurities(
			Set<UserServiceSecurity> UserServiceSecurities) {
		this.UserServiceSecurities = UserServiceSecurities;
	}

}